<%--
  Created by IntelliJ IDEA.
  User: jhx0221
  Date: 2021/4/27
  Time: 10:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<% String path = request.getContextPath() + "/"; %>
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <base href="<%=path%>">
    <meta charset="UTF-8">
    <title>同业竞争与关联交易</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="layui/css/font.css">
    <link rel="stylesheet" href="layui/css/xadmin.css">
    <script src="layui/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="layui/js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th colspan="8" style="font-size: 16px;font-weight: bold;">
                                (一)同业竞争
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td rowspan="2" width="200"  align="center">
                                企业是否存在同业竞争情况，如存在请描述同业竞争情况。
                                /或上传相关资料附件
                            </td>
                            <td colspan="6">
                                   <textarea placeholder="请输入内容" id="desc" name="desc" class="layui-textarea">
                                   ${horizontal.indcompetTrade.industryCompeteDisc}
                                   </textarea>
                            </td>
                        </tr>
                        <c:choose>
                        <c:when test="${fn:length(horizontal.relatedparty)==0}">
                            <tr>
                                <td colspan="6">暂无数据</td>
                            </tr>
                        </c:when>
                        <c:otherwise>
                                <tr>
                                    <td colspan="6">
                                        <button type="button" class="layui-btn" ><i class="layui-icon"></i>上传相关附件</button>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="8" style="font-size: 16px;font-weight: bold;">
                                        (二)关联交易
                                    </td>
                                </tr>
                                <tr >
                                    <td rowspan="2" align="center">
                                        主要关联方及关联方关系如下
                                    </td>
                                    <td  colspan="6">
                                        <table >
                                            <tr align="center">
                                                <td>
                                                    序号
                                                </td>
                                                <td>
                                                    关联序号
                                                </td>
                                                <td>
                                                    关联名称
                                                </td>
                                                <td>
                                                    备注
                                                </td>
                                            </tr>
                                            <c:forEach items="${horizontal.relatedparty}" var="horizontal"
                                                       varStatus="s">
                                            <tr align="center">
                                                <td>
                                                   ${s.count}
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${horizontal.relationshipNum}">
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${horizontal.relationshipName}">
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${horizontal.relationshipComment}">
                                                </td>
                                            </tr>
                                            </c:forEach>
                                       </c:otherwise>
                                 </c:choose>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6">
                                <button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>上传相关附件</button>
                            </td>
                        </tr>
                        <c:choose>
                        <c:when test="${fn:length(horizontal.briefrelationship)==0}">
                            <tr>
                                <td colspan="6">暂无数据</td>
                            </tr>
                        </c:when>
                        <c:otherwise>
                        <tr>
                            <td rowspan="2"  align="center">
                                关联方交易简要情况
                            </td>
                            <td  colspan="6">
                                <table >
                                    <tr align="center">
                                        <td rowspan="2">
                                            序号
                                        </td>
                                        <td rowspan="2">
                                            关联方交易对手
                                        </td>
                                        <td rowspan="2">
                                            交易内容
                                        </td>
                                        <td>
                                            2020年度
                                        </td>
                                        <td>
                                            2019年度
                                        </td>
                                        <td>
                                            2018年度
                                        </td>
                                        <td rowspan="2">
                                            备注
                                        </td>
                                    </tr>
                                      <tr align="center">
                                                <td colspan="3">
                                                    关联交易金额
                                                </td>

                                            </tr>
                                    <c:forEach items="${horizontal.briefrelationship}" var="briefrelationship"
                                               varStatus="s">
                                            <tr align="center">
                                                <td>
                                                    ${s.count}
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${briefrelationship.relationCounterparty}">
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${briefrelationship.tradeContent}">
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${briefrelationship.firstTradeMoney}">
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${briefrelationship.secondTradeMoney}">
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${briefrelationship.thirdTradeMoney}">
                                                </td>
                                                <td>
                                                    <input type="text"  name="email" required="" lay-verify="email" autocomplete="off" class="layui-input" value="${briefrelationship.tradeComment}">
                                                </td>
                                            </tr>
                                            </c:forEach>
                                   </c:otherwise>
                         </c:choose>
                                </table>
                            </td>
                        </tr>


                        <tr align="center">
                            <td colspan="8">
                                <button class="layui-btn" lay-filter="add" lay-submit="">保存</button>
                                <button class="layui-btn" lay-filter="add" lay-submit="">提交</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['laydate','form','upload'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;
        var $ = layui.jquery;
        var upload = layui.upload;


        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
//指定允许上传的文件类型
        upload.render({
            elem: '#test3'
            ,url: 'https://httpbin.org/post' //改成您自己的上传接口
            ,accept: 'file' //普通文件
            ,done: function(res){
                layer.msg('上传成功');
                console.log(res);
            }
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });


    });

    /*用户-停用*/
    function member_stop(obj,id){
        layer.confirm('确认要停用吗？',function(index){

            if($(obj).attr('title')=='启用'){

                //发异步把用户状态进行更改
                $(obj).attr('title','停用')
                $(obj).find('i').html('&#xe62f;');

                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                layer.msg('已停用!',{icon: 5,time:1000});

            }else{
                $(obj).attr('title','启用')
                $(obj).find('i').html('&#xe601;');

                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                layer.msg('已启用!',{icon: 5,time:1000});
            }

        });
    }

    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!',{icon:1,time:1000});
        });
    }



    function delAll (argument) {
        var ids = [];

        // 获取选中的id
        $('tbody input').each(function(index, el) {
            if($(this).prop('checked')){
                ids.push($(this).val())
            }
        });

        layer.confirm('确认要删除吗？'+ids.toString(),function(index){
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
    }
</script>
</html>